<?php
/*  
  Copyright (c) 2010-02 SongCMS 
  SongCMS All Rights Reserved. 
  Support:www.SongCMS.com
  QQ:544255858   19951025
  Author:Song  Version:3.17
  Date:2010-08-12 09:28:32
*/
$db = new db();
if(empty($sGET['i']) || !is_numeric($sGET['i'])){
	$SQL = "SELECT `ID` FROM `{$dbprefix}article` WHERE `ArticleRela` LIKE '%{$sGET['c']}%' ORDER BY `ArticleSort` DESC,`ID` ASC LIMIT 0,1";
	$re = $db -> SelectSQL($SQL,0);
	$sGET['i'] = $re[0][0];
	unset($re);
}
$article = new article();
$article -> Lang = $Lang;
$article -> Ltext = $Html['page'];
@$TemFileArr = $article -> TemFile($sGET['c'],$sGET['i']);
$SQL = "SELECT * FROM `{$dbprefix}article` WHERE `ID` = '{$sGET['i']}'";
$sc = $db -> SelectSQL($SQL,1);
@$sdb->Related($sc[0]['ID'],'article');
if(!empty($sGET['c'])){ 
	if(empty($sGET['e'])) $TemFile = $TemFileArr[0]; 
	$Navig = ArticleName($sGET['c'],' >> ',1); 
	$cCname = explode('|',$sGET['c']);
}elseif (is_numeric($sGET['i'])){ 
	if(empty($sGET['e'])) $TemFile = $TemFileArr[1];	
	$Navig = ArticleName($sc[0]['ArticleRela'],' >> ',1);
	$cCname = explode('|',$sc[0]['ArticleRela']);
	$cv['ID'] = $sc[0]['ID']; 
	$cv['type'] = 0;  
	$cv['xtype'] = 'page'; 
	$cv['Agree'] = $sc[0]['ArticleAgree']; 
	$cv['Disagree'] = $sc[0]['ArticleDisagree']; 
	$cv['AgreeTotal'] = $sc[0]['ArticleAgree'] + $sc[0]['ArticleDisagree']; 
	$cv['AgreePercent'] = @round($sc[0]['ArticleAgree']/$cv['AgreeTotal']*100,1); 
	$cv['DisagreePercent'] = @round($sc[0]['ArticleDisagree']/$cv['AgreeTotal']*100,1); 
	$cv['AgreeWidth'] = @round($cv['AgreePercent'] * 142/100); 
	$cv['DisagreeWidth'] = @round($cv['DisagreePercent'] * 142/100); 
	$cv['CommentURL'] = $Lang == 1 ? "./?fcomment/t0/i{$sc[0]['ID']}" : "./?fcomment/l{$Lang}/t0/i{$sc[0]['ID']}"; 
	$cv['CURL'] = $Lang == 1 ? "./?fcomment/t0/i{$sc[0]['ID']}" : "./?fcomment/l{$Lang}/t0/i{$sc[0]['ID']}"; 
	$cv['CommentTotal'] = $sdb -> CommentTotal(0,$sc[0]['ID']); 
	$SC -> assign('cv',$cv);
	if(!empty($sc[0]['ArticleKeyWord'])) $WebConfig['Webkeyword'] = $sc[0]['ArticleKeyWord'];
	$aparr['word'] = $sc[0]['ArticleContent'];
	$aparr['length'] = 200;
	$aparr['illegal'] = 1;
	$aparr['suffix'] = "";
	$WebConfig['WebDescription'] = $sdb -> html2txt($aparr);
	$SC -> assign('Web',$WebConfig);	
} else {
	die($Warning[7]);
}
if(!empty($sGET['w'])){ 
	$article -> isSelect = trim($sGET['w']);
}
$pe = array(
	'RootID' => $TemFileArr[2], 
	'RootName' => ArticleName($cCname[0]), 
	'cName' => ArticleName($cCname[count($cCname)-1]), 
	'Sort' => $Navig, 
); 
$SC -> assign('pe',$pe);
$SC -> assign('sc',array_shift($sc));
$product = new product();
$product -> Lang = $Lang;
$product -> Ltext = $Html['page'];
$SC -> register -> templateObject("product",$product);
$news = new news();
$news -> Lang = $Lang;
$news -> Ltext = $Html['page'];
$SC -> register -> templateObject("news",$news);
$SC -> register -> templateObject("article",$article);
$SC -> register -> templateObject("sdb",$sdb);
include_once($CodeList . 'top.php');
include_once($CodeList . 'bottom.php');
$SC -> display($TemFile,$GetUrlPar);
unset($db,$SQL,$sc);
?>